package com.azier.kapacitor.script.method;

import com.azier.kapacitor.script.arg.*;
import com.azier.kapacitor.util.CollectionUtil;

import java.util.ArrayList;

/**
* 1 * @Author: luoj
* 2 * @Date: 2019/11/8 11:27
* 3
*/
public class ${name} extends AbstractMethod {
    private static final String name = "${name?uncap_first}";
<#if noteEn??>
    /**
    ${noteEn!}
    **/
</#if>
<#if note??>
    /**
    ${note!}
    **/
</#if>
    public ${name}(<#if args??&&(args?size>0)><#list args as arg><#if arg.timeArg??&&arg.timeArg==1>long interval, String durationLiteral<#else >${arg.type!} <#if arg.isList??&&arg.isList==1>...</#if>${arg.name?uncap_first}</#if><#if arg_has_next>, </#if></#list></#if>) {
        super(new ArrayList<>(), name);
<#if args??&&(args?size>0)>
    <#list args as arg>
        //<#--如Quite-->
        <#if arg.timeArg??&&arg.timeArg==1>
        this.args.add(new OriginalArg(interval + durationLiteral));
        <#else >
            <#if arg.isList??&&arg.isList==1>
        for(${arg.type!} argf : ${arg.name?uncap_first}){
            this.args.add(new ${arg.convertType!}(argf));
        }
            <#else>
        this.args.add(new ${arg.convertType!}(${arg.name?uncap_first}));
            </#if>

        </#if>

    </#list>
</#if>
    }
}
